using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Effects;


namespace advadev.Windows.Graph
{

    /// <summary>
    /// Represents a color filter effect
    /// </summary>
    public class ColorFilterEffect : ShaderEffect
    {

        /// <summary>for internal use</summary>
        static private PixelShader _pixelShader = new PixelShader() { UriSource = new Uri(@"pack://application:,,,/advadev.Windows.Graph;component/Effects/ColorFilterEffect.ps") };


        /// <summary>
        /// Initializes a new instance of the ColorFilterEffect class
        /// </summary>
        public ColorFilterEffect()
        {
            PixelShader = _pixelShader;
            UpdateShaderValue(InputProperty);
        }


        #region dependency properties
        static public readonly DependencyProperty FilterColorProperty = DependencyProperty.Register("FilterColor", typeof(Color), typeof(ColorFilterEffect), new UIPropertyMetadata(Colors.Transparent, PixelShaderConstantCallback(0)));
        public Color FilterColor
        {
            get { return (Color)GetValue(FilterColorProperty); }
            set { SetValue(FilterColorProperty, value); }
        }

        static internal readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(ColorFilterEffect), 0);
        internal Brush Input
        {
            get { return (Brush)GetValue(InputProperty); }
            set { SetValue(InputProperty, value); }
        }
        #endregion dependency properties

    }

}
